package com.sukaiyi.giteeideaplugin.cellrenderer;

import cn.hutool.json.JSONObject;
import com.intellij.ui.ColoredListCellRenderer;
import icons.PluginIcons;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

/**
 * @author sukaiyi
 * @date 2020/07/01
 */
public class RepoBranchListCellRenderer extends ColoredListCellRenderer<JSONObject> {
    @Override
    protected void customizeCellRenderer(@NotNull JList<? extends JSONObject> list, JSONObject value, int index, boolean selected, boolean hasFocus) {
        if (value != null) {
            setIcon(PluginIcons.FORK);
            append(value.getStr("name"));
        }
    }
}
